package com.trmp.order.dao.impl;

import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

public class OrdersInfoDaoImpl {
	@PersistenceContext
	protected EntityManager em;
	public String getOrderNum(String type)
	{
		String sql="select s_order_id.nextval from dual";
		Query query= em.createNativeQuery(sql);
		Object object=query.getSingleResult();
		SimpleDateFormat sdf = new SimpleDateFormat("yyMMdd");
		DecimalFormat df=new DecimalFormat("000000"); 
		return sdf.format(new Date())+type+df.format(object);
	}
}
